﻿@model CoreHome.HomePage.ViewModels.PaginationViewModel

<div class="pagination-container">
    <ul class="pagination justify-content-end">

        @if(Model.showStart)
        {
            <li class="page-item PagedList-skipToFirst">
                <a class="page-link" asp-controller="Blog" asp-action="@Model.ActionName" asp-route-index="1">&lt;&lt;</a>
            </li>
        }

        @if (Model.showPrevious)
        {
            <li class="page-item PagedList-skipToNext">
                <a class="page-link" asp-controller="Blog" asp-action="@Model.ActionName" asp-route-index="@(Model.CurrentIndex-1)" rel="next">&lt;</a>
            </li>
        }

        @foreach (KeyValuePair<int, bool> index in Model.Indexs)
        {
            if(index.Key == Model.CurrentIndex)
            {
                <li class="page-item active">
                    <span class="page-link">@index.Key</span>
                </li>
            }
            else
            {
                <li class="page-item">
                    <a class="page-link" asp-controller="Blog" asp-action="@Model.ActionName" asp-route-index="@index.Key">@index.Key</a>
                </li>
            }
        }

        @if (Model.showNext)
        {
            <li class="page-item PagedList-skipToNext">
                <a class="page-link" asp-controller="Blog" asp-action="@Model.ActionName" asp-route-index="@(Model.CurrentIndex+1)" rel="next">&gt;</a>
            </li>
        }

        @if (Model.showEnd)
        {
            <li class="page-item PagedList-skipToLast">
                <a class="page-link" asp-controller="Blog" asp-action="@Model.ActionName" asp-route-index="@Model.PageCount">&gt;&gt;</a>
            </li>
        }
    </ul>
</div>